package com.ds.controller.restful;

import java.util.Map;

import com.ds.orm.model.BlogDiscuss;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import org.springframework.http.MediaType;

import com.ds.core.util.WebUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import com.ds.core.base.BaseController;

/**
 * <p>
 * 评论  前端控制器
 * </p>
 *
 * @author Du
 * @since 2017-11-28
 */
@RestController
@RequestMapping("/blogDiscuss")
@Api(value = "评论接口", description = "评论接口")
public class BlogDiscussController extends BaseController<BlogDiscuss> {
	public String getService() {
		return "blogDiscuss#endService";
	}

	@RequiresPermissions("blogDiscuss.read")
	@PutMapping(value = "/read/list")
	@ApiOperation(value = "查询评论", produces = MediaType.APPLICATION_JSON_VALUE)
	public Object query(HttpServletRequest request) {
		Map<String, Object> param = WebUtil.getParameter(request);
        ModelMap modelMap = new ModelMap();
		return super.query(modelMap, param);
	}

	@RequiresPermissions("blogDiscuss.read")
	@PutMapping(value = "/read/detail")
	@ApiOperation(value = "评论详情", produces = MediaType.APPLICATION_JSON_VALUE)
	public Object get(HttpServletRequest request) {
		BlogDiscuss param = WebUtil.getParameter(request, BlogDiscuss.class);
        ModelMap modelMap = new ModelMap();
		return super.get(modelMap, param);
	}

	@PostMapping
	@RequiresPermissions("blogDiscuss.update")
	@ApiOperation(value = "修改评论", produces = MediaType.APPLICATION_JSON_VALUE)
	public Object update(HttpServletRequest request) {
		BlogDiscuss param = WebUtil.getParameter(request, BlogDiscuss.class);
        ModelMap modelMap = new ModelMap();
		return super.update(modelMap, param);
	}

	@DeleteMapping
	@RequiresPermissions("blogDiscuss.delete")
	@ApiOperation(value = "删除评论表", produces = MediaType.APPLICATION_JSON_VALUE)
	public Object delete(HttpServletRequest request) {
		BlogDiscuss param = WebUtil.getParameter(request, BlogDiscuss.class);
        ModelMap modelMap = new ModelMap();
		return super.delete(modelMap, param);
	}
}
